package com.vsoft.sms_cm;
import java.net.UnknownHostException;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import com.vsoft.anti_fra.TestQuery;
import com.vsoft.framework.core.BusiObj;
import com.vsoft.framework.core.Configuration;
import com.vsoft.framework.server.servlet.SessionData;

import redis.clients.jedis.Jedis;
import com.vsoft.framework.core.BaseException;
import com.vsoft.framework.core.BusiObj;
import com.vsoft.framework.core.Configuration;
import com.vsoft.framework.core.db.DBGadgets;
import com.vsoft.framework.core.db.DBTrans;
import com.vsoft.framework.core.db.OperAgent;
import com.vsoft.framework.core.db.SQLArgs;
import com.vsoft.framework.core.esb.ServiceBus;
import com.vsoft.framework.core.util.BOHelper;
import com.vsoft.framework.core.util.LogCollect;
import com.vsoft.framework.core.util.XMLUtil;
import com.vsoft.framework.server.servlet.SessionData;
import com.vsoft.framework.server.servlet.HttpUtil;
public class testRedisGet {
	private static Logger vLogger = Logger.getLogger(testRedisGet.class);
	private static String vName = testRedisGet.class.getName();
	private SessionData vSD = null;
	private String vDebugHome = "";
	private BusiObj				vInBO		=  new BusiObj();
	private final static String		RESULT			="RESULT";
	public static void main(String[] args) throws BaseException  
	{
		//10.45.7.74 6379   vinaphone smart
	
		String 	ip				=	args[0];
		String	port	=	args[1];
		//PropertyConfigurator.configure("log4j.properties");
		HashMap<String,String> dbConfig	= new HashMap<String,String>();

		try {
			Configuration.InitSystem();
			Logger vLogger = Logger.getLogger(testRedisGet.class);
			dbConfig.put("IP", ip);
			dbConfig.put("PORT", port);
			Jedis jedis = new Jedis(ip);
			//Connection conn = DBTrans.getConnection();

			vLogger.info("---------------test redis get-------------");
			long start_time=System.currentTimeMillis();
			vLogger.info("---------------start-------------"+start_time);
			vLogger.info("\n====================get single hash====================\n")	;
			Map<String, String> map=jedis.hgetAll("trigger:05514008801670");
			  for   (String key  : map.keySet()){    
				  System.out.println("键:" + key + "\t值:" + map.get(key));  

		          //map.get(o);    
		  }  
			 // jedis.set("testChina", "中国sss刚刚来到.....");
			  String testChinaValue = jedis.get(" testChina".trim());
			  vLogger.info("---------------中文支持测试-------------"+testChinaValue);
			jedis.disconnect();

			long end_time=System.currentTimeMillis();
			vLogger.info("---------------end-------------"+end_time);

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public void  init()
	{
		
	}

}
